apiVersion: v1
kind: Service
metadata:
{{- if .Values.service.annotations }}
  annotations:
{{ tpl (toYaml .Values.service.annotations) . | indent 4 }}
{{- end }}
  name: {{ include "kafdrop.fullname" . }}-svc
  labels:
    {{- include "kafdrop.labels" . | nindent 4 }}
spec:
  type: {{ .Values.service.type }}
  ports:
    - port: {{ .Values.service.port }}
      targetPort: http
      protocol: TCP
      name: http
{{ if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort))) }}
      nodePort: {{.Values.service.nodePort}}
{{ end }}
  selector:
    {{- include "kafdrop.selectorLabels" . | nindent 4 }}
